package com.zx.system.block.enums;


import lombok.Getter;

/**
 * <p>
 * description: 缓存页面或组件枚举定义 <br>
 * create: 2024-09-08 17:29
 * </p>
 *
 * @author zhou  xun
 */
@Getter
public enum ComponentCacheEnum {
    CACHE(1, "缓存", true),
    NO_CACHE(0, "不缓存", false);
    /**
     * code
     */
    private final Integer code;
    /**
     * 说明
     */
    private final String desc;
    /**
     * 布尔值
     */
    private final boolean boolValue;

    ComponentCacheEnum(Integer code, String desc, boolean boolValue) {
        this.code = code;
        this.desc = desc;
        this.boolValue = boolValue;
    }

    public static ComponentCacheEnum getEnumByDesc(String desc) {
        for (ComponentCacheEnum value : values()) {
            if (value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }

    public static ComponentCacheEnum getEnumByCode(Integer code) {
        for (ComponentCacheEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }


}
